home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / MacTCP Library 1.1 / Library / LowLevel ƒ / Headers ƒ / MyTCPIncludes.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-04  |  7.2 KB  |  236 lines  |  [TEXT/SPM ]

  1. /*
  2.  
  3.     myTCPIncludes.h
  4.  
  5.     Header file for MacTCP Library
  6.  
  7.     11/28/94 mc - Created.
  8. */
  9.  
  10. #pragma once
  11.  
  12. #ifndef __MACTCP_LIB_H
  13. #define __MACTCP_LIB_H
  14.  
  15. #include <MacTCP.h>
  16. #include <MacTCPExtras.h>
  17. #include <AddressXlation.h>
  18.  
  19. // Library error codes
  20. enum {
  21.  
  22.     tcpBaseErr=23100,        // the base for the TCP portion of the library
  23.     tcpNilPB,                // the TCPiopb pointer was nil.
  24.     tcpNilStream,            // the ioCRefNum field of the TCPiopb was nil.
  25.     tcpNilRefNum,            // the ioRefNum field of the TCPiopb was nil.
  26.  
  27.     udpBaseErr=23150,        // the base error for the UDP portion of the library
  28.     udpNilPB,                // the UDPiopb pointer was nil.
  29.     udpNilRefNum,            // the ioCRefNum field of the UDPiopb was nil
  30.     udpNilStream,            // the udpStream field of the UDPiopb was nil
  31.     udpPortNil,            // the starting port for UDPMultiCreate was 0 (not allowed).
  32.  
  33.     ipBaseErr=23250,        // base error value for the IP portion of the library
  34.     ipNilRefNum,            // the IPiopb ioCRefNum was nil.
  35.  
  36.     getipBaseErr=23300,    // the base address for the GetIP portion of the library
  37.     getipNilPB,            // the GetIPParmBlkPtr was nil
  38.     getipNilRefNum,        // the ioCRefNum was nil
  39.  
  40.     dnrBaseErr=23050,        // base error number for the resolver portion of the library
  41.     dnrNoResolver            // The resolver is not open.
  42. };
  43.  
  44. typedef pascal void (*ExitToShellProcPtr)(void);
  45.  
  46. enum {
  47.     uppExitToShellProcInfo=kPascalStackBased
  48. };
  49.  
  50. #if USESROUTINEDESCRIPTORS
  51.     typedef UniversalProcPtr ExitToShellUPP;
  52.     
  53.     #define CallExitToShellProc(routine)\
  54.         CallUniversalProc((UniversalProcPtr)routine,uppExitToShellProcInfo)
  55.     #define NewExitToShellProc(routine)\
  56.         (ExitToShellUPP)NewRoutineDescriptor((ProcPtr)(routine),uppExitToShellProcInfo,GetCurrentISA())
  57. #else
  58.     typedef ExitToShellProcPtr ExitToShellUPP;
  59.     
  60.     #define CallExitToShellProc(routine) \
  61.         (*routine)()
  62.     #define NewExitToShellProc(routine) \
  63.         (ExitToShellUPP)(routine)
  64. #endif
  65.  
  66. #define DisposeExitToShellProc(routine) \
  67.     DisposeRoutineDescriptor(routine)
  68.  
  69. #ifndef NewHostInfoProc
  70.  
  71. // these defines are missing from AddressXlation.h Apple supplies
  72. #if GENERATINGCFM
  73.  
  74. #define NewHostInfoProc(userRoutine)        \
  75.         (HInfoUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppHInfoProcInfo, GetCurrentArchitecture())
  76.  
  77. #else
  78.  
  79. #define NewHostInfoProc(userRoutine)        ((HInfoUPP)userRoutine)
  80.  
  81. #endif
  82.  
  83. #define DisposeHostInfoProc(routine)\
  84.     DisposeRoutineDescriptor((UniversalProcPtr)routine)
  85. // -------------------------
  86.  
  87. #endif /* NewHostInfoProc */
  88.  
  89. #ifndef NEWBLOCK
  90. #define NEWBLOCK
  91.  
  92. #define NEWPTR(a,b) ((a)NewPtr(b))
  93. #define DISPOSEPTR(a) (DisposePtr((Ptr)a))
  94.  
  95. #define NEWHDL(a,b) ((a)NewHandle(b))
  96. #define DISPOSEHDL(a) (DisposeHandle((Handle)a))
  97. #endif /* NEWBLOCK */
  98.  
  99. // ••• Pointer Allocation Definitions
  100.  
  101. #define NewGetIPParmBlkPtr() NEWPTR(GetAddrParamBlock*,sizeof(GetAddrParamBlock))
  102. #define DisposeGetIPParmBlkPtr(a) DISPOSEPTR(a)
  103.  
  104. #define Newnbp_entryPtr() NEWPTR(nbp_entryPtr,sizeof(nbp_entry))
  105. #define Disposenbp_entryPtr(a) DISPOSEPTR(a)
  106.  
  107. #define NewEnet_addrPtr() NEWPTR(Enet_addrPtr,sizeof(Enet_addr))
  108. #define DisposeEnet_addrPtr(a) DISPOSEPTR(a)
  109.  
  110. #define Newarp_entryPtr() NEWPTR(arp_entryPtr,sizeof(arp_entry))
  111. #define Disposearp_entryPtr(a) DISPOSEPTR(a)
  112.  
  113. #define NewLAPStatsPtr() NEWPTR(LAPStatsPtr,sizeof(LAPStats))
  114. #define DisposeLAPStatsPtr(a) DISPOSEPTR(a)
  115.  
  116. #define NewIPEchoPtr() NEWPTR(IPEchoPBPtr,sizeof(IPEchoPB))
  117. #define DisposeIPEchoPtr(a) DISPOSEPTR(a)
  118.  
  119. #define NewLAPStatsPBPtr() NEWPTR(LAPStatsPBPtr,sizeof(LAPStatsPB))
  120. #define DisposeLAPStatsPBPtr(a) DISPOSEPTR(a)
  121.  
  122. #define NewIPParmBlkPtr() NEWPTR(IPParmBlkPtr,sizeof(IPParamBlock))
  123. #define DisposeIPParmBlkPtr(a) DISPOSEPTR(a)
  124.  
  125. #define NewICMPEchoInfoPtr() NEWPTR(ICMPEchoInfoPtr,sizeof(ICMPEchoInfo))
  126. #define DisposeICMPEchoInfoPtr(a) DISPOSEPTR(a)
  127.  
  128. #define NewICMPParmBlkPtr() NEWPTR(ICMPParmBlkPtr,sizeof(ICMPParmBlk))
  129. #define DisposeICMPParmBlkPtr(a) DISPOSEPTR(a)
  130.  
  131. #define NewTCPCreatePtr() NEWPTR(TCPCreatePBPtr,sizeof(TCPCreatePB))
  132. #define DisposeTCPCreatePtr(a) DISPOSEPTR(a)
  133.  
  134. #define NewTCPOpenPtr() NEWPTR(TCPOpenPBPtr,sizeof(TCPOpenPB))
  135. #define DisposeTCPOpenPtr(a) DISPOSEPTR(a)
  136.  
  137. #define NewTCPSendPtr() NEWPTR(TCPSendPBPtr,sizeof(TCPSendPB))
  138. #define DisposeTCPSendPtr(a) DISPOSEPTR(a)
  139.  
  140. #define NewTCPReceivePtr() NEWPTR(TCPReceivePBPtr,sizeof(TCPReceivePB))
  141. #define DisposeTCPReceivePtr(a) DISPOSEPTR(a)
  142.  
  143. #define NewTCPClosePtr() NEWPTR(TCPClosePBPtr,sizeof(TCPClosePB))
  144. #define DisposeTCPClosePtr(a) DISPOSEPTR(a)
  145.  
  146. #define NewHistoBucketPtr() NEWPTR(HistoBucketPtr,sizeof(HistoBucket))
  147. #define DisposeHistoBucketPtr(a) DISPOSEPTR(a)
  148.  
  149. #define NewTCPConnectionStatsPtr() NEWPTR(TCPConnectionStatsPBPtr,sizeof(TCPConnectionStatsPB))
  150. #define DisposeTCPConnectionStatsPtr(a) DISPOSEPTR(a)
  151.  
  152. #define NewTCPStatusPtr() NEWPTR(TCPStatusPBPtr,sizeof(TCPStatusPB))
  153. #define DisposeTCPStatusPtr(a) DISPOSEPTR(a)
  154.  
  155. #define NewTCPAbortPtr() NEWPTR(TCPAbortPBPtr,sizeof(TCPAbortPB))
  156. #define DisposeTCPAbortPtr(a) DISPOSEPTR(a)
  157.  
  158. #define NewTCPParamPtr() NEWPTR(TCPParamPBPtr,sizeof(TCPParamPB))
  159. #define DisposeTCPParamPtr(a) DISPOSEPTR(a)
  160.  
  161. #define NewTCPStatsPtr() NEWPTR(TCPStatsPBPtr,sizeof(TCPStatsPB))
  162. #define DisposeTCPStatsPtr(a) DISPOSEPTR(a)
  163.  
  164. #define NewTCPGlobalInfoPtr() NEWPTR(TCPGlobalInfoPBPtr,sizeof(TCPGlobalInfoPB))
  165. #define DisposeTCPGlobalInfoPtr(a) DISPOSEPTR(a)
  166.  
  167. #define NewTCPiopbPtr() NEWPTR(TCPiopb *,sizeof(TCPiopb))
  168. #define DisposeTCPiopbPtr(a) DISPOSEPTR(a);
  169.  
  170. #define NewUDPCreatePtr() NEWPTR(UDPCreatePBPtr,sizeof(UDPCreatePB))
  171. #define DisposeUDPCreatePtr(a) DISPOSEPTR(a)
  172.  
  173. #define NewUDPSendPtr() NEWPTR(UDPSendPBPtr,sizeof(UDPSendPB))
  174. #define DisposeUDPSendPtr(a) DISPOSEPTR(a)
  175.  
  176. #define NewUDPReceivePtr() NEWPTR(UDPReceivePBPtr,sizeof(UDPReceivePB))
  177. #define DisposeUDPReceivePtr(a) DISPOSEPTR(a)
  178.  
  179. #define NewUDPMTUPtr() NEWPTR(UDPMTUPBPtr,sizeof(UDPMTUPB))
  180. #define DisposeUDPMTUPtr(a) DISPOSEPTR(a)
  181.  
  182. #define NewUDPiopbPtr() NEWPTR(UDPiopb *,sizeof(UDPiopb))
  183. #define DisposeUDPiopbPtr(a) DISPOSEPTR(a);
  184.  
  185.  
  186. /*
  187.     Library Function Prototypes
  188. */
  189. #ifdef __cplusplus
  190. extern "C" {
  191. #endif
  192.  
  193. // MacTCP.c
  194. OSErr OpenMacTCP(short*,Boolean patchExitToShell);
  195. OSErr KillMacTCP(void);
  196.  
  197. // GetMyIPAddr.c
  198. OSErr GetMyIPAddr(GetAddrParamBlock* pb,Boolean async);
  199.  
  200. // IP.c
  201. OSErr IP_EchoICMP(struct ICMPParamBlock * pb,Boolean async);
  202. OSErr IP_LAPStats(struct ICMPParamBlock * pb,Boolean async);
  203.  
  204. // TCP.c
  205. OSErr TCP_Create(TCPiopb * pb,Boolean async);
  206. OSErr TCP_PassiveOpen(TCPiopb * pb,Boolean async);
  207. OSErr TCP_ActiveOpen(TCPiopb * pb,Boolean async);
  208. OSErr TCP_Send(TCPiopb * pb,Boolean async);
  209. OSErr TCP_NoCopyRcv(TCPiopb * pb,Boolean async);
  210. OSErr TCP_RcvBfrReturn(TCPiopb * pb,Boolean async);
  211. OSErr TCP_Rcv(TCPiopb * pb,Boolean async);
  212. OSErr TCP_Close(TCPiopb * pb,Boolean async);
  213. OSErr TCP_Abort(TCPiopb * pb,Boolean async);
  214. OSErr TCP_Status(TCPiopb * pb,Boolean async);
  215. OSErr TCP_ExtendedStat(TCPiopb * pb,Boolean async);
  216. OSErr TCP_Release(TCPiopb * pb,Boolean async);
  217. OSErr TCP_GlobalInfo(TCPiopb * pb,Boolean async);
  218.  
  219. // UDP.c
  220. OSErr UDP_Create(UDPiopb * pb,Boolean async);
  221. OSErr UDP_Read(UDPiopb * pb,Boolean async);
  222. OSErr UDP_BfrReturn(UDPiopb * pb,Boolean async);
  223. OSErr UDP_Write(UDPiopb * pb,Boolean async);
  224. OSErr UDP_Release(UDPiopb * pb,Boolean async);
  225. OSErr UDP_MaxMTUSize(UDPiopb * pb,Boolean async);
  226. OSErr UDP_Status(UDPiopb * pb,Boolean async);
  227. OSErr UDP_MultiCreate(UDPiopb * pb,Boolean async);
  228. OSErr UDP_MultiSend(UDPiopb * pb,Boolean async);
  229. OSErr UDP_MultiRead(UDPiopb * pb,Boolean async);
  230.  
  231. #ifdef __cplusplus
  232. }
  233. #endif
  234.  
  235. #endif
  236.